<template>
    <div class="car-models">
        <div class="container">
            <h2 class="title">预约车型</h2>
            <div class="models-grid">
                <div class="model-card" v-for="model in carModels" :key="model.name">
                    <div class="model-image">
                        <img :src="model.image" :alt="model.name" />
                    </div>
                    <div class="model-name">{{ model.name }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
const carModels = [
    { name: '大众', image: new URL('../images/volkswagen.jpg', import.meta.url).href },
    { name: '比亚迪', image: new URL('../images/byd.jpg', import.meta.url).href },
    { name: '宝马', image: new URL('../images/bmw.jpg', import.meta.url).href },
    { name: '本田', image: new URL('../images/honda.jpg', import.meta.url).href },
    { name: '索纳塔', image: new URL('../images/sonata.jpg', import.meta.url).href },
    { name: '君越', image: new URL('../images/lacrosse.jpg', import.meta.url).href },
    { name: '昂科威', image: new URL('../images/envision.jpg', import.meta.url).href },
    { name: '起亚', image: new URL('../images/kia.jpg', import.meta.url).href }
]
</script>

<style scoped>
.car-models {
    padding: 60px 0;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 40px;
    color: #333;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.model-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.model-card:hover {
    transform: translateY(-5px);
}

.model-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.model-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-name {
    padding: 15px;
    text-align: center;
    font-size: 18px;
    color: #333;
}
</style>